
ENT.Base = "base_brush"
ENT.Type = "brush"

function ENT:Initialize()
	self.dir = self.dir or Vector( 0, 0, 0 )
	self.power = self.power or 2000
	self.enabled = self.enabled or 1
end

function ENT:KeyValue( key, value )
	if key == "direction" then
		local ang = string.Explode( " ", value )
		self.dir = Angle( ang[1], ang[2], ang[3] ):Forward() --Make the angle a normalized vector :D
	end
	if key == "power" then
		self.power = tonumber(value)
	end
	if key == "enabled" then
		self.enabled = tonumber(value)
	end
end

function ENT:AcceptInput( input, activator, caller )
	if input == "Enable" then
		self.enabled = 1
	end
	if input == "Disable" then
		self.enabled = 0
	end
end

function ENT:StartTouch( ent )
	if ent:GetClass() ~= "melon_npc" || ent:GetModel() == "models/props_junk/Watermelon01.mdl" then
		ent.AIbrush = self
	end
end

function ENT:EndTouch( ent )
	if ent.AIbrush == self then
		if ent.LastAI then
			ent.AIbrush = ent.LastAI
		else
			ent.AIbrush = nil
		end
		ent.LastAI = self
	end
end
